---
layout: "default"
title: "Operator: ??"
description: "Swift documentation for the '??' operator."
root: "/v2.2"
---

<code class="language-swift">infix operator ?? {
    associativity right
    precedence 131
}</code>

<h3>Declarations</h3>

<div class="declaration" id="func-qmqm-t_-t-defaultvalue_-throws-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-qmqm-t_-t-defaultvalue_-throws-t">func ?? &lt;T&gt;(<wbr>_:<wbr> T?, defaultValue: () throws -&gt; T)</a>
        
<div class="comment collapse" id="comment-func-qmqm-t_-t-defaultvalue_-throws-t"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func ??&lt;T&gt;(optional: T?, @autoclosure defaultValue: () throws -&gt; T) -&gt; T</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-qmqm-t_-t-defaultvalue_-throws-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-qmqm-t_-t-defaultvalue_-throws-t">func ?? &lt;T&gt;(<wbr>_:<wbr> T?, defaultValue: () throws -&gt; T?)</a>
        
<div class="comment collapse" id="comment-func-qmqm-t_-t-defaultvalue_-throws-t"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func ??&lt;T&gt;(optional: T?, @autoclosure defaultValue: () throws -&gt; T?) -&gt; T?</code>
    
    
</div></div>
</div>
